extends base

block vars
  - var title = 'Log In'
  - var description = 'Log into your account!'
  - var bodytag = 'login'
  - var socialProviders = stormpathConfig.web.social

block body

  .container.custom-container
    .va-wrapper
      .view.login-view.container
        .box.row
          if hasSocialProviders
            - var cls = 'small col-sm-8'
          else
            - var cls = 'large col-sm-12'

          div(class='email-password-area col-xs-12 #{cls}')
            .header
              span.
                Select Your Organization

            if error
              .alert.alert-danger.bad-login
                p #{error}

            if formErrors
              .alert.alert-danger.bad-login
                each error in formErrors
                  p #{error.error}

            form.login-form.form-horizontal(method='post', role='form', action=formActionUri)
              input(name='_csrf', type='hidden', value=csrfToken)

              each field in formModel.fields

                div(class='form-group group-' + field.name)
                  label(
                    class='col-sm-12',
                    for='#{field.name}'
                  ) #{field.label}

                  div(class='col-sm-8')
                    input.form-control(
                      id=field.name,
                      name=field.name,
                      type=field.type,
                      placeholder=field.placeholder,
                      autofocus=isLoginField ? 'true' : 'false',
                      required=field.required ? 'true' : 'false',
                      value=form.data && isLoginField ? form.data[field.name] : ''
                    )

                  div(class='col-sm-4')
                    button.login.btn.btn-login.btn-sp-green(type='submit') Continue
